from BeautifulSoup import BeautifulSoup

__author__ = 'Administrator'

import urllib,urllib2,cookielib
from BeautifulSoup import BeautifulSoup
myCookie = urllib2.HTTPCookieProcessor(cookielib.CookieJar())
openner = urllib2.build_opener(myCookie)

post_data = {'email':'yinjj472@nenu.edu.cn',
             'password':'112074',
             'origURL':'http://www.renren.com/Home.do',
             'domain':'renren.com'}
req = urllib2.Request('http://www.renren.com/PLogin.do', urllib.urlencode(post_data))
html_src = openner.open(req).read()
#print(html_src),"####################"
#parser = BeautifulSoup(html_src)
#
#article_list = parser.find('div', 'feed-list').findAll('article')
#for my_article in article_list:
#    state = []
#    for my_tag in my_article.h3.contents:
#        factor = my_tag.string
#        if factor != None:
#            factor = factor.replace(u'\xa0','')
#            factor = factor.strip(u'\r\n')
#            factor = factor.strip(u'\n')
#            state.append(factor)
#    print ' '.join(state)
req = urllib2.Request('http://friend.renren.com/GetFriendList.do?curpage=2&id=227638867')
html_src = openner.open(req).read()
print(html_src)